The Vectorisation Monad
نویسندگان
چکیده
Traditionally a vectorising compiler matches the iterative constructs of a program against a set of predeened templates. If a loop contains no dependency cycles then a map template can be used; other simple dependencies can often be expressed in terms of fold or scan templates. This paper addresses the template matching problem within the context of functional programming. A small collection of program identities are used to specify vectorisable for-loops. By incorporating these program identities within a monad, all well-typed for-loops in which the body of the loop is expressed using the vectorisation monad can be vectorised. This technique enables the elimination of template matching from a vectorising compiler, and the proof of the safety of vectorisation can be performed by a type inference mechanism.
منابع مشابه
Parallel Haskell: the Vectorisation Monad 2 Parallelising Simple Loops 2 2 Parallelising Simple Loops
It has long been known that some of the most common uses of for and while-loops in imperative programs can easily be expressed using the standard higher-order functions fold and map. With this correspondence as a starting point, we derive parallel implementations of various iterative constructs, each having a better complexity than their sequential counterparts, and explore the use of monads to...
متن کاملParallel Haskell: the Vectorisation Monad
It has long been known that some of the most common uses of for and while-loops in imperative programs can easily be expressed using the standard higher-order functions fold and map. With this correspondence as a starting point, we derive parallel implementations of various iterative constructs, each having a better complexity than their sequential counterparts, and explore the use of monads to...
متن کاملPartial Vectorisation of Haskell Programs
Vectorisation for functional programs, also called the flattening transformation, relies on drastically reordering computations and restructuring the representation of data types. As a result, it only applies to the purely functional core of a fully-fledged functional language, such as Haskell or ML. A concrete implementation needs to apply vectorisation selectively and integrate vectorised wit...
متن کاملA cottage industry of lax extensions
In this work, we describe an adjunction between the comma category of Set-based monads under the V -powerset monad and the category of associative lax extensions of Set-based monads to the category of V -relations. In the process, we give a general construction of the Kleisli extension of a monad to the category of V-relations.
متن کاملApplications of the Kleisli and Eilenberg-Moore 2-adjunctions
In 2010, J. Climent Vidal and J. Soliveres Tur developed, among other things, a pair of 2-adjunctions between the 2-category of adjunctions and the 2-category of monads. One is related to the Kleisli adjunction and the other to the Eilenberg-Moore adjunction for a given monad.Since any 2-adjunction induces certain natural isomorphisms of categories, these can be used to classify bijection...
متن کامل